package com.wy2.eclipse.tool.ui.handlers;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.wy2.eclipse.tool.ui.dialog.AboutDialog;

/**
 * Our sample handler extends AbstractHandler, an IHandler base class.
 * @see org.eclipse.core.commands.IHandler
 * @see org.eclipse.core.commands.AbstractHandler
 */
public class AboutHandler extends AbstractHandler {
	
	private static final Logger logger=LoggerFactory.getLogger(AboutHandler.class);

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		//logger.info("{} - {}", "about.....",DatetimeTools.getCurrentDatetime());
		
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
		
		AboutDialog dialog=new AboutDialog(window.getShell());
		int returncode=dialog.open();
		logger.info("returncode: {} ",returncode);
		
		

		
		
		
		

		
//		MessageDialog.openInformation(
//				window.getShell(),
//				"Ui",
//				"Hello, Eclipse world");
//		logger.error("异常",new Throwable("模拟异常"));
		return null;
	}
}
